/**  
 * 文 件 名: ClientFilter.java  
 * 描    述：   
 * 版    权：Copyright (c)20012-2012 tongzhou All Rights Reserved.
 * 公    司: 同舟 
 * 作    者：彭定雄                     
 * 版    本: 1.0  
 * 创建时间: 2012-10-27
 *  
 * 修改历史：  
 * 时间                             作者                       版本                        描述  
 * ------------------------------------------------------------------  
 * 2012-10-27        彭定雄                1.0          1.0 Version  
 */         

/**
 * 
 */
package com.tongzhou.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.tongzhou.util.SessionUtil;
import com.tongzhou.util.Util;

public class ClientFilter implements Filter {

	@Override
	public void destroy() {
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		String uid = request.getParameter("uid");
		String aid = request.getParameter("aid");
		if (uid != null && aid != null && !"".equals(aid) && !"".equals(uid))
		{
			aid = Util.urlAndBaseDecode(aid);
			SessionUtil.updateExpiryDate(SessionUtil.createSessionId(uid, aid));
		}
		chain.doFilter(request, response);
	}

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
	}


}
